Skip to content

Conversation

@alexggh
Copy link
Contributor

@alexggh alexggh commented Dec 18, 2025

Work in progress

Description

Implements the proposed changes from here #10452, where the API surface has been limited to two functions submit and a subscribe_statement.

Submit changes

For submitting the only changes are implementing the logic of the newly expiry field where statements with an expiration timestamp lower than current time get rejected.

Subscribe changes

For subscription the approach is to have a configurable number of workers that keep track of all subscriptions, each time a new subscription arrives it gets assigned by a round-robin protocol to one of the workers.

When a new statements gets accepted by the statement-store it notifies all workers about the statement, the workers then go and evaluate all subscription filters they are assigned to and notifies each of them accordingly.

Remaining work

  • Add more tests.
  • Evaluate performance under load and port statement_store_bench.rs to using subscribe API, ported and performance stay the same on the benchmark, because bottlenecks are elsewhere and being addressed.
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench] Participants: 49998, each sent: 6, received: 0
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench] Summary        min       avg       max
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench]  time, s         8        19        24
[2026-01-07T17:18:51Z INFO  tests::zombie_ci::statement_store_bench]  retries         0         0         0
  • Evaluate and set proper RPC limits. The normal RPC limits apply here we just need to make sure RPC nodes run with limits high enough, so each user can connect to the node all at the same time.
  • Periodically scan existing statements and removed expired ones.
  • Plan for deploying it with minimising impact for people prototype with the old APIs
    • This modifies statement format(expiry field), Runtime and Node need to run latest version.

Local testing

To obtain a local node with the new APIs available run:

cargo build -p polkadot -p polkadot-parachain-bin  --bin polkadot --bin polkadot-prepare-worker --bin polkadot-execute-worker --bin polkadot-parachain  --features fast-runtime;
 
ZOMBIE_PROVIDER=native cargo test -p cumulus-zombienet-sdk-tests --features zombie-ci zombie_ci::statement_store::statement_store

The rpc addresses are visible in the output:

charlie: direct link (pjs) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:26997#/explorer
dave: direct link (pjs) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:12623#/explorer

AndreiEres and others added 28 commits November 25, 2025 16:04
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
@alexggh alexggh changed the base branch from alexggh/api-consolidation to master January 8, 2026 15:39
@alexggh alexggh changed the title [DRAFT] statement-store: implement new api statement-store: implement new rpc api Jan 8, 2026
@alexggh alexggh marked this pull request as ready for review January 8, 2026 15:41
@alexggh alexggh added the T0-node This PR/Issue is related to the topic “node”. label Jan 12, 2026
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/20922436110
Failed job name: cargo-clippy

Signed-off-by: Alexandru Gheorghe <[email protected]>
Copy link
Contributor

@AndreiEres AndreiEres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Alex!
Looks good, left a few questions.

Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just skimming it for now. The API itself looks good and quite intuitive. I'm yet to understand the mechanics happening inside.

@P1sar
Copy link

P1sar commented Jan 14, 2026

Closes: #10568, #10457

Signed-off-by: Alexandru Gheorghe <[email protected]>
log::info!("Statement store test passed");
log::info!("Keeping network alive");

tokio::time::sleep(Duration::from_hours(24)).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need hang the test for 24h?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is there for App guys to have a node setup they can run locally, will remove it before merge.

fn try_into(self) -> Result<CheckedTopicFilter> {
match self {
TopicFilter::Any => Ok(CheckedTopicFilter::Any),
TopicFilter::MatchAll(topics) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check topics.len() <= 4?

let mut evicted = HashSet::new();
let mut would_free_size = 0;
let priority = Priority(statement.priority().unwrap_or(0));
let expiry = Expiry(statement.expiry());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not statement.expiry() -> Expiry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants